package com.atis.warplot.database;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.annotations.Proxy;

@Entity
@Table(name = "t_mapa")
@Proxy(lazy = false)
public class Mapa {

	private int id;

	private String nombre;

	private List<FilaHexagono> filaHexagono = //
			new ArrayList<FilaHexagono>();

	// --------------------------------------------------------------------------------

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	// --------------------------------------------------------------------------------

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	// --------------------------------------------------------------------------------

	@OneToMany(mappedBy = "mapaRef", orphanRemoval = true)
	@LazyCollection(LazyCollectionOption.TRUE)
	@Cascade({CascadeType.ALL})
	public List<FilaHexagono> getFilaHexagono() {
		return filaHexagono;
	}

	public void setfilaHexagono(List<FilaHexagono> filaHexagono) {
		this.filaHexagono = filaHexagono;
	}

	// --------------------------------------------------------------------------------

}
